﻿using System;
using Zeus.Thunder.Core;

namespace SharpTrainer.Algorithm
{
    class RandomArraySort : ITestCase
    {
        public void Run()
        {
            int[] arr = new int[10];

            int iSeed = 10;
            Random ro = new Random(iSeed);
            int iResult;
            int iUp = 1000;

            for (int i = 0; i < 10; i++)
            {
                iResult = ro.Next(iUp);
                arr[i] = iResult;
            }

            Console.WriteLine("Before Sort:");
            Display(arr);
            Console.WriteLine();

            SortUtil.BubbleSort(arr);

            Console.WriteLine("After Sort:");
            Display(arr);
            Console.WriteLine();

            Console.Read();
        }

        private void Display(int[] arr)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                Console.Write(arr[i]);
                Console.Write(" ");
            }
        }
    }
}
